#include <stdio.h>
#include <stdlib.h>

int main()
{
  int i; 
  int j;
  int max;
  int n=0;
  char str[1000];
  scanf("%s",&str);

  char zm[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  int gs[26]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  for(j=0;j<26;j++)
  {
    for(i=0;str[i]!='\0';i++)
      {
        if(str[i]==zm[j])
        {
            gs[j] = gs[j]+1;
        }
      }
  }
  max = gs[0];
  for(j=0;j<26;j++)
  {
    if(gs[j]>max)
    {
            max=gs[j];
          n=j;
      }
  }
  printf("%c\n",zm[n]);
  printf("%d\n",gs[n]);

  return 0;
}